package com.rjkj.medicalwaste.utils;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * Created by Administrator on 2018/12/28.
 */

public class StrUtils {
    public static String removePoint(String str){
        String strs="";
        if(str!=null){
            if(!str.isEmpty()){
                if(str.indexOf(".")>-1){
                    strs=str.split("\\.")[0];
                }
            }
        }
        return strs;
    }
    public static boolean isNullOrEmpty(String string){
        return string == null || string.length()==0;
    }

    public static String genRandomNum(int len) {
        final int maxNum = 9;
        int i;  //生成的随机数
        int count = 0; //生成的密码的长度
        StringBuilder pwd = new StringBuilder();
        Random r = new Random();
        while (count < len) {
            //生成随机数，取绝对值，防止生成负数，
            i = Math.abs(r.nextInt(maxNum));  //生成的数最大为36-1
            pwd.append(i);
            count++;
        }
        return pwd.toString();
    }
}
